package com.vrv.app.cyberspace.modules.sys.controller;


import com.vrv.app.cyberspace.common.utils.JSONResult;
import com.vrv.app.cyberspace.common.validator.ValidatorUtils;
import com.vrv.app.cyberspace.modules.sys.entity.BaseTable;
import com.vrv.app.cyberspace.modules.sys.entity.InformationTable;
import com.vrv.app.cyberspace.modules.sys.service.IInformationTableService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sm
 * @since 2017-12-15
 */
@Api(description="信息")
@RestController
@RequestMapping("/sys/information")
public class InformationTableController extends BaseController {
    @Autowired
    private IInformationTableService informationTableService;

    @PostMapping()
    public JSONResult addInformation(BaseTable bt, InformationTable it){
        ValidatorUtils.validateEntity(bt);
        ValidatorUtils.validateEntity(it);
        bt.setCreateUserID(getUserId());
        return informationTableService.addInformation(bt,it);
    }

    @PutMapping("/{id}")
    public JSONResult updateInformation(@PathVariable Integer id,BaseTable bt, InformationTable it){
        return informationTableService.updateInformation(id,bt,it);
    }
}

